package kz.pompei.oneGwtStands.client.PersonroleManagerStand;

import kz.pompei.OneGwt.client.personrole.PersonroleManagerMed;
import kz.pompei.OneGwt.client.personrole.impl.PersonroleManagerBuilder;
import kz.pompei.OneGwt.ifaces.util.Handler;
import kz.pompei.oneGwtStands.client.remote.fake.PersonroleManagerServiceFake;
import kz.pompei.oneGwtStands.client.stand.Stand;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Widget;

public class PersonroleManagerStandEP implements EntryPoint {
  @Override
  public void onModuleLoad() {
    
    final PersonroleManagerBuilder builder = new PersonroleManagerBuilder();
    builder.setService( new PersonroleManagerServiceFake() );
    
    builder.build();
    
    Stand stand = new Stand();
    
    Widget ui = builder.getContainerUI();
    ui.setWidth( "800px" );
    ui.setHeight( "300px" );
    stand.setSource( ui );
    
    stand.run();
    
    stand.injectMenuItem( "PersonroleManagerMed->refresh", new Handler() {
      @Override
      public void handle() {
        PersonroleManagerMed mediator = builder.getMediator();
        mediator.refresh();
      }
    } );
  }
}
